<?php
/**
 * User: helu
 * Date: 17-2-14
 * Time: 上午10:48
 */

require_once "dbcon.php";
require_once "BTParamBean.php";
require_once "CommonBean.php";

$dbConn = getDB();

$rbean = new CommonBean();
$databean = new BTParamBean();

if ($dbConn == null) {
    $rbean->code = 500;
    $rbean->message = "数据库连接错误";
    echo json_encode($rbean);
    $dbConn->close();
    return;
}

$sql = "SELECT bta,btn FROM a1001221749.lubike";
$result = $dbConn->query($sql);

if (gettype($result) == "boolean") {
    $rbean->code = 400;
    $rbean->message = "未设置蓝牙距离换算参数";
    echo json_encode($rbean);
    $dbConn->close();
    return;
}

$arr = $result->fetch_row();


$databean->bta = $arr[0];
$databean->btn = $arr[1];


$rbean->code = 200;
$rbean->message = "成功";
$rbean->data = $databean;

echo json_encode($rbean);

$dbConn->close();

